﻿// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。

#ifndef PCH_H
#define PCH_H

// 添加要在此处预编译的标头
#include "framework.h"

#define YICT_ERROR_UNKNOWN					-999;
#define YICT_ERROR_DLL_NOT_FOUND			-888;
#define YICT_ERROR_DEVICE_PORT				-777;
#define YICT_ERROR_KEY						-666;
#define YICT_ERROR_LOAD_KEYA				-333;
#define YICT_ERROR_LOAD_KEYB				-222;
#define YICT_ERROR_AUTH				        -401;
#define YICT_ERROR_WRITE_CARD				-998;
#define YICT_ERROR_RESET     				-997;
#define YICT_RESET_CARD     				-996;

#define YICT_SUCC_WRITE_CARD				1;
#define YICT_SUCC_READ_CARD					1;
#define YICT_ERROR_READ_CARD				0;
#define YICT_ERROR_CARD_NOT_FOUND			2;
#define YICT_ERROR_SELECT_CARD				3;
#define YICT_ERROR_NO_REMOVE_CARD           -3;

typedef int(WINAPI *CVR_InitComm)(int);
typedef int(WINAPI *CVR_CloseComm)();
typedef int(WINAPI *CVR_Authenticate)();
typedef int(WINAPI *CVR_Read_Content)(int);
typedef int(WINAPI *GetPeopleName)(char*, int*);
typedef int(WINAPI *GetPeopleIDCode)(char*, int*);

typedef int(WINAPI  *rf_init_def)(int port, long baud);
typedef int(WINAPI  *rf_exit_def)(int icdev);
typedef int(WINAPI  *rf_load_key_def)(int icdev, unsigned char _Mode, unsigned char _SecNr, unsigned char *_NKey);
typedef int(WINAPI  *rf_card_def)(int icdev, unsigned char _Mode, unsigned long *_Snr);
typedef int(WINAPI  *rf_read_def)(int icdev, unsigned char _Adr, unsigned char *_Data);
typedef int(WINAPI  *rf_authentication_def)(int icdev, unsigned char _Mode, unsigned char _SecNr);
typedef int(WINAPI  *rf_halt_def)(int icdev);
typedef int(WINAPI  *rf_beep_def)(int icdev, unsigned short _Msec);
typedef int(WINAPI  *rf_reset_def)(int icdev, int _Msec);

// add by xyang in 2022.5.9 desc 写卡句柄
// public native short rf_load_key(int var1, short var2, short var3, char[] var4);
// public native short rf_write(int var1, short var2, char[] var3); 
typedef int(WINAPI* rf_request_def)(int icdev, unsigned char _Mode, unsigned int *TagType);
typedef int(WINAPI* rf_anticoll_def)(int icdev, unsigned char _Bcnt, unsigned long *_Snr);
typedef int(WINAPI* rf_select_def)(int icdev, unsigned long _Snr, unsigned char *_Size);
typedef int(WINAPI* getTagTypeDef)();
typedef long(WINAPI* getSnrDef)();
typedef int(WINAPI* rf_write_def)(int icdev, unsigned char block, unsigned char *_Data);


extern "C" _declspec(dllexport) int ForceReconnect();

extern "C" _declspec(dllexport) int xexit(int code);
extern "C" _declspec(dllexport) int GetIDCardInfo(int port, char* name, int* name_len, char* idcode, int* idcode_len);
extern "C" _declspec(dllexport) int GetICCardInfo(int port, char *card_id, int *card_id_len, char* permit_no, int *permit_no_len, char* resu, char* no_halt);
extern "C" _declspec(dllexport) int GetICCardInfoNotHalt(int port, char* card_id, int* card_id_len, char* permit_no, int* permit_no_len, char* resu, char* no_halt);

extern "C" _declspec(dllexport) void getDevices(char *devs);


// add by xyang in 2022.5.9 desc 写卡函数
extern "C" _declspec(dllexport) int WriteCard(int port, unsigned char* p8, unsigned char* p9, char* resu);
extern "C" _declspec(dllexport) int ReadCard(int port, char* p8, int* p8_len, char* p9, int* p9_len, char* resu);

#endif //PCH_H
